#include "lvgl_project.h"


void lvgl_main_init()
{
    //根节点点，所有的page都以这个lv_obj_t为parent，各自独立
    lv_obj_t *root = lv_page_manager_create(lv_scr_act());

    //根节点 根据root节点创建page
    lv_page_create(root, MAIN_PAGE);
    lv_page_create(root, WEATHER_RAGE);
    lv_page_create(root, WEATHER_RAGE1);
    lv_page_create(root, START_PAGE);

    //绑定page构造函数和开始动画，默认没有
    lv_page_bind_create(MAIN_PAGE, lv_desktop_create);
    lv_page_bind_entry(MAIN_PAGE, lv_desktop_entry_ani);

    lv_page_bind_create(WEATHER_RAGE, lv_weather_page_create);
    lv_page_bind_entry(WEATHER_RAGE, lv_desktop_entry_ani);

    lv_page_bind_create(WEATHER_RAGE1, lv_weather_page_create);
    lv_page_bind_entry(WEATHER_RAGE, lv_desktop_entry_ani);

    lv_page_bind_create(START_PAGE, start_page);

    //首次必须先加载main_page,调用所有的构造函数
    lv_main_page_start_up(MAIN_PAGE);
    lv_page_load_main(START_PAGE);
}

